package main

import (
	"fmt"
)
import "github.com/360EntSecGroup-Skylar/excelize"

var tableNameMap = make(map[string]string)
var sheetNames = []string{"Parts-同步零件采购", "Parts-同步零件销售", "Parts-同步零件移库单", "Parts-同步零件入库单",
	"Parts-同步零件盘点单", "Parts-同步零件采购发票录入", "Parts-同步零件库存"}
var excelName = "C:\\Users\\cpr271\\Desktop\\bmw\\SPARK接口整理 -20201214.xlsx"

func main() {
	ImportFromXLS(excelName, sheetNames)
	for _, value := range tableNameMap {
		fmt.Println(value)
	}
}

func ImportFromXLS(file string, sheetNames []string) string {
	fmt.Println(file)
	f, err := excelize.OpenFile(file)
	if err != nil {
		fmt.Println(err)
		return err.Error()
	}

	// Get all the rows in the Sheet1.
	for _, sheetName := range sheetNames {
		rows := f.GetRows(sheetName)
		for _, row := range rows {
			tableName := row[5]
			fmt.Println(sheetName, tableName)
			tableNameMap[tableName] = tableName
		}
	}
	return file
}
